package org.ResearchProject.mapper;

import org.ResearchProject.pojo.Tutor;
import org.ResearchProject.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.ArrayList;

/**
 * 2024-12-13-12:52
 */
@Mapper
public interface TutorMapper {
    // 插入导师
    @Insert("insert into tutor(username,password,email,phoneNum,address,avatar,gender,name,auth) " +
            "values(#{username},#{password},#{email},#{phoneNum},#{address},#{avatar},#{gender},#{name},#{auth})")
    void addTutor(User user);
    // 根据用户名查询用户
    @Select("select * from tutor where username=#{username}")
    Tutor selectByUsername(String username);

    void updateTutor(User user);
    @Update("update tutor set password=#{newPassword} where username=#{username}")
    void updateTutorPwd(String newPassword,String username);
    @Select("select * from tutor")
    ArrayList<Tutor> selectAll();

    ArrayList<Tutor> conditionSelect(Tutor tutor);
    @Select("select * from tutor where wx_openid=#{openid}")
    Tutor selectByOpenid(String openid);
}
